package net.jlibrary.account.action.vo;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

import net.jlibrary.account.domain.Employee;
import net.jlibrary.common.CoreConstants;
import net.jlibrary.common.core.annotation.PropertyVoPo;
import net.jlibrary.common.core.annotation.PropertyVoPoCondition;
import net.jlibrary.common.core.annotation.VoForPo;
import net.jlibrary.common.core.entity.BaseVo;
import net.jlibrary.common.project.domain.Group;
import net.jlibrary.common.project.domain.PermissionRole;
import net.jlibrary.common.tools.MD5Encrypt;

@VoForPo(Employee.class)
public class EmployeeAdminActionVo extends BaseVo {
	private static final long serialVersionUID = -127633223415668724L;
	private Long id;
	private String mobile;
	@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
	@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
	private Date joinDate;
	private String code;
	private GroupVo group;
	@PropertyVoPo(value = PropertyVoPoCondition.Array2Collection, children = "id")
	private Long[] roles;
	private String password;
	private String name;
	private boolean valid;
	private boolean online;
	private String uid;
	private String role;

	@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
	@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
	private Date createdate;
	@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
	@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
	private Date lastdate;

	public EmployeeAdminActionVo() {
		group = new GroupVo();
	}

	public Long getId() {
		return id;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	@Override
	public Serializable getPrimaryKey() {
		return id;
	}

	@Override
	public Serializable getText() {
		return code;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Date getJoinDate() {
		return joinDate;
	}

	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public GroupVo getGroup() {
		return group;
	}

	public void setGroup(GroupVo group) {
		this.group = group;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = MD5Encrypt.getInstance().encrypt(password);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean getValid() {
		return valid;
	}

	public void setValid(boolean valid) {
		this.valid = valid;
	}

	public boolean getOnline() {
		return online;
	}

	public void setOnline(boolean online) {
		this.online = online;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public Date getCreatedate() {
		return createdate;
	}

	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}

	public Date getLastdate() {
		return lastdate;
	}

	public void setLastdate(Date lastdate) {
		this.lastdate = lastdate;
	}

	@VoForPo(Group.class)
	public class GroupVo extends BaseVo {
		private static final long serialVersionUID = -8541489466203273017L;
		private Long id;
		private String code;
		private String globalPath;
		private String fullName;
		private String shortName;
		private boolean valid;
		private boolean allowQueryInvalid;
		private boolean compellingDelete;
		private String loginMode;
		@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
		@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
		private Date createdate;
		@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
		@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
		private Date lastdate;

		public Long getId() {
			return id;
		}

		@Override
		public Serializable getPrimaryKey() {
			return id;
		}

		@Override
		public Serializable getText() {
			return shortName;
		}

		public void setId(Long id) {
			this.id = id;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getGlobalPath() {
			return globalPath;
		}

		public void setGlobalPath(String globalPath) {
			this.globalPath = globalPath;
		}

		public String getFullName() {
			return fullName;
		}

		public void setFullName(String fullName) {
			this.fullName = fullName;
		}

		public String getShortName() {
			return shortName;
		}

		public void setShortName(String shortName) {
			this.shortName = shortName;
		}

		public boolean getValid() {
			return valid;
		}

		public void setValid(boolean valid) {
			this.valid = valid;
		}

		public boolean getAllowQueryInvalid() {
			return allowQueryInvalid;
		}

		public void setAllowQueryInvalid(boolean allowQueryInvalid) {
			this.allowQueryInvalid = allowQueryInvalid;
		}

		public boolean getCompellingDelete() {
			return compellingDelete;
		}

		public void setCompellingDelete(boolean compellingDelete) {
			this.compellingDelete = compellingDelete;
		}

		public String getLoginMode() {
			return loginMode;
		}

		public void setLoginMode(String loginMode) {
			this.loginMode = loginMode;
		}

		public Date getCreatedate() {
			return createdate;
		}

		public void setCreatedate(Date createdate) {
			this.createdate = createdate;
		}

		public Date getLastdate() {
			return lastdate;
		}

		public void setLastdate(Date lastdate) {
			this.lastdate = lastdate;
		}
	}

	@VoForPo(PermissionRole.class)
	public class PermissionRoleVo extends BaseVo {
		private static final long serialVersionUID = -1459413442534616483L;
		private Long id;
		private String code;
		private String name;
		private String description;
		private boolean remoteLogin;
		private boolean valid;
		private boolean allowQueryInvalid;
		private boolean compellingDelete;
		private String validString;
		private String remoteLoginString;
		private String codeRightSearchKey;
		@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
		@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
		private Date createdate;
		@DateTimeFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT)
		@JsonFormat(pattern = CoreConstants.DATETIME_FORMAT_DEFAULT, timezone = CoreConstants.DATE_TIMEZONE_DEFAULT)
		private Date lastdate;

		public Long getId() {
			return id;
		}

		@Override
		public Serializable getPrimaryKey() {
			return id;
		}

		@Override
		public Serializable getText() {
			return name;
		}

		public void setId(Long id) {
			this.id = id;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public boolean getRemoteLogin() {
			return remoteLogin;
		}

		public void setRemoteLogin(boolean remoteLogin) {
			this.remoteLogin = remoteLogin;
		}

		public boolean getValid() {
			return valid;
		}

		public void setValid(boolean valid) {
			this.valid = valid;
		}

		public boolean getAllowQueryInvalid() {
			return allowQueryInvalid;
		}

		public void setAllowQueryInvalid(boolean allowQueryInvalid) {
			this.allowQueryInvalid = allowQueryInvalid;
		}

		public boolean getCompellingDelete() {
			return compellingDelete;
		}

		public void setCompellingDelete(boolean compellingDelete) {
			this.compellingDelete = compellingDelete;
		}

		public String getValidString() {
			return validString;
		}

		public void setValidString(String validString) {
			this.validString = validString;
		}

		public String getRemoteLoginString() {
			return remoteLoginString;
		}

		public void setRemoteLoginString(String remoteLoginString) {
			this.remoteLoginString = remoteLoginString;
		}

		public String getCodeRightSearchKey() {
			return codeRightSearchKey;
		}

		public void setCodeRightSearchKey(String codeRightSearchKey) {
			this.codeRightSearchKey = codeRightSearchKey;
		}

		public Date getCreatedate() {
			return createdate;
		}

		public void setCreatedate(Date createdate) {
			this.createdate = createdate;
		}

		public Date getLastdate() {
			return lastdate;
		}

		public void setLastdate(Date lastdate) {
			this.lastdate = lastdate;
		}
	}

	public Long[] getRoles() {
		return roles;
	}

	public void setRoles(Long[] roles) {
		this.roles = roles;
	}

}
